package com.example.my_module;
import androidx.annotation.RequiresApi;
import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Build;
import android.widget.Button;
import android.widget.TextView;
import com.example.mylibrary.testActivity.Basemodule.Base_Activity;

public class MainActivity extends Base_Activity {
    Button button;
    TextView Y;
    private static String[] PERMISSIONS_STORAGE = {
            Manifest.permission.ACCESS_COARSE_LOCATION,
            Manifest.permission.ACCESS_FINE_LOCATION,
            Manifest.permission.READ_PHONE_STATE
    };
    @Override
    public int initLayout() { return R.layout.activity_main; }
    @Override
    public void initData() {
        setPermissions(PERMISSIONS_STORAGE);
        button = findViewById(R.id.button);
        Y = findViewById(R.id.textView3);
        button.setOnClickListener(v -> {

        });
        Y.setOnClickListener(v -> {

        });
    }
    @Override
    public void initResume() {
    }
    @Override
    public void initDestroy() {
    }
    /**
     *   在相应的页面接收回调
     * @param
     * @return
     */
    @RequiresApi(api = Build.VERSION_CODES.M)
    @Override
    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
        switch (requestCode){
            case 0x01:
                for(String Permissions:permissions){if(checkSelfPermission (Permissions)!= PackageManager.PERMISSION_GRANTED){dialogin();return; } }
                //申请权限成功之后的操作
                //申请权限成功之后的操作
                break;
        }
    }

}